//
//  IManager+ModuleCommitActivity.m
//  RocketProject
//
//  Created by Wu Chengwei on 13-9-28.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+ModuleCommitActivity.h"
#import "FrameworkRelativeDefines.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "NSString+NSString_Ex_.h"
#import "TravelException.h"
#import "GloableEngineService.h"
#import "RCFeedbackDataModel.h"

@implementation IManager(ModuleCommitActivity)

-(int64_t)requestCommitOrder:(NSString *)shopID withName:(NSString *)name withContent:(NSString *)content withPhone:(NSString *)phone withDate:(NSString *)date withTime:(NSString *)time withPeopleNum:(NSString *)num withType:(NSString *)type withSex:(NSString *)sex withDelegate:(id<IManagerDelegate>)delegate{
    if ([NSString stringIsNullOrEmpty:shopID]) {
        return kInvalidRequestId;
    }
    if (nil == phone) {
        phone = @"";
    }
    if (nil == name) {
        name = @"";
    }
    if (nil == content) {
        content = @"";
    }
    if (nil == date) {
        date = @"";
    }
    if (nil == time) {
        time = @"";
    }
    if (nil == num) {
        num = @"";
    }
    if (nil == type) {
        type = @"";
    }
    NSMutableDictionary *postValue = [NSMutableDictionary dictionary];
    [postValue setObject:content forKey:@"content" withDefaultValue:@""];
    [postValue setObject:phone forKey:@"phone" withDefaultValue:@""];
    [postValue setObject:name forKey:@"name" withDefaultValue:@""];
    [postValue setObject:shopID forKey:@"shopid" withDefaultValue:@""];
    [postValue setObject:date forKey:@"date" withDefaultValue:@""];
    [postValue setObject:time forKey:@"time" withDefaultValue:@""];
    [postValue setObject:num forKey:@"person" withDefaultValue:@""];
    [postValue setObject:type forKey:@"type" withDefaultValue:@""];
    [postValue setObject:sex forKey:@"sex" withDefaultValue:@""];
    [postValue setObject:[GloableEngineService sharedInstance].bduss forKey:@"bduss" withDefaultValue:@""];
    // 异步获取数据
    NSString *urlSuffix = kRCActivityCommitPrefix;
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncPostData:url postValues:postValue postDataList:nil userInfo:nil withDataParseClass:[RCFeedbackDataModel class] withDataDelegate:delegate];
}
@end
